﻿@{
    Layout = "~/Views/Shared/_Root.cshtml";
}
@using Nop.Core.Infrastructure;
@using Nop.Services.Configuration;
@{
    
    //current category ID
    int currentCategoryId = 0;
    if (Url.RequestContext.RouteData.Values["controller"].ToString().Equals("catalog", StringComparison.InvariantCultureIgnoreCase) &&
        Url.RequestContext.RouteData.Values["action"].ToString().Equals("category", StringComparison.InvariantCultureIgnoreCase))
    {
        currentCategoryId = Convert.ToInt32(Url.RequestContext.RouteData.Values["categoryId"].ToString());
    }


    //current manufacturer ID
    int currentManufacturerId = 0;
    if (Url.RequestContext.RouteData.Values["controller"].ToString().Equals("catalog", StringComparison.InvariantCultureIgnoreCase) &&
        Url.RequestContext.RouteData.Values["action"].ToString().Equals("manufacturer", StringComparison.InvariantCultureIgnoreCase))
    {
        currentManufacturerId = Convert.ToInt32(Url.RequestContext.RouteData.Values["manufacturerId"].ToString());
    }

    //current product ID
    int currentProductId = 0;
    if (Url.RequestContext.RouteData.Values["controller"].ToString().Equals("catalog", StringComparison.InvariantCultureIgnoreCase) &&
        Url.RequestContext.RouteData.Values["action"].ToString().Equals("product", StringComparison.InvariantCultureIgnoreCase))
    {
        currentProductId = Convert.ToInt32(Url.RequestContext.RouteData.Values["productId"].ToString());
    }
    var electronicsThemeSettings = EngineContext.Current.Resolve<SevenSpikes.Theme.Electronics.Domain.ElectronicsThemePluginsIntegrationSettings>();

    var categoryNavigationEnabled = EngineContext.Current.Resolve<SevenSpikes.Theme.Electronics.Domain.ElectronicsThemeSettings>().DefaultCategoryNavigationEnabled;    
}
@if (IsSectionDefined("MainSlider"))
{
    @RenderSection("MainSlider") 
}
<div class="master-wrapper-leftside-3">
    @if (IsSectionDefined("left"))
    {
        @RenderSection("left")
    }
    else
    {
        @Html.Action("WidgetsByZone", "Widget", new { widgetZone = "left_side_column_before" })
        
        if (IsSectionDefined("left_block"))
        {
        @RenderSection("left_block") 
        }

        if (categoryNavigationEnabled)
        {
        @Html.Action("CategoryNavigation", "Catalog", new { currentCategoryId = currentCategoryId, currentProductId = currentProductId })
        }
        
        @Html.Action("CompareProducts", "ElectronicsThemeCommon")

        @Html.Action("WidgetsByZone", "Widget", new { widgetZone = "electronics_left_side_banner" })

        @Html.Action("NewsletterBox", "Newsletter")

        @Html.Action("ManufacturerNavigation", "Catalog", new { currentManufacturerId = currentManufacturerId })

        @Html.Action("PopularProductTags", "Catalog")

        @Html.Action("PollBlock", "Poll", new { systemKeyword = "LeftColumnPoll" })

        @Html.Action("WidgetsByZone", "Widget", new { widgetZone = "left_side_column_after" })
    }
</div>
<div class="master-wrapper-center-3">
    <div class="master-wrapper-cph-3">
        <div class="main-content">
            @Html.Action("WidgetsByZone", "Widget", new { widgetZone = "main_column_before" })
            @RenderBody()
            @Html.Action("WidgetsByZone", "Widget", new { widgetZone = "main_column_after" })
        </div>
        <!--main-content-->
    </div>
</div>
<div class="master-wrapper-rightside-3">
    @if (IsSectionDefined("right"))
    {
        @RenderSection("right")
    }
    else
    {
        @Html.Action("WidgetsByZone", "Widget", new { widgetZone = "right_side_column_before" })
        
        @Html.Action("RecentlyViewedProductsBlock", "Catalog")        
        
        @Html.Action("WidgetsByZone", "Widget", new { widgetZone = "electronics_right_side_banner" })
        
        @Html.Action("PollBlock", "Poll", new { systemKeyword = "RightColumnPoll" })
        
        @Html.Action("WidgetsByZone", "Widget", new { widgetZone = "right_side_column_after" })
    }
</div>
